package net.bplaced.streetfighter.lib.service;

import java.util.ArrayList;
import java.util.List;

import net.bplaced.streetfighter.lib.model.AppVersion;
import net.bplaced.streetfighter.lib.utils.ServiceReturnPackage;

import org.apache.http.NameValuePair;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.message.BasicNameValuePair;

/**
 * @author Sebastian Hoffmann <bo.hoffi@googlemail.com>
 */
public class UpdateCheckService
        extends CommonService<AppVersion[]> {

    public ServiceReturnPackage<AppVersion[]> fetchVersionsViaPOST(final String identifier) {

        final HttpPost httppost = new HttpPost("http://streetfighter.bplaced.net/services/UpdateService.php");

        final List<NameValuePair> parameters = new ArrayList<NameValuePair>(1);
        parameters.add(new BasicNameValuePair("identifier", identifier));

        return this.sendRequest(httppost, parameters, AppVersion[].class);
    }
}